package
{
	import flash.display.Sprite;
	
	import oboe.controllers.StateMachine;
	import oboe.core.Oboe;
	
	import states.designer.DesignerPerspective;
	import states.layout.LayoutPerspective;
	
	public class ScreenFlow extends StateMachine
	{
		public function ScreenFlow(mainSprite:Sprite)
		{
			var params:Object = mainSprite.loaderInfo.parameters;
			for( var key:String in params )	Oboe.flags[ key ] = params[ key ];
			super(mainSprite);
		}
		
		[slot] public function onAddToStage():void
		{
			this.addState("designer", new DesignerPerspective());
			this.addState("layout", new LayoutPerspective());
			switch( Oboe.flags.mode )
			{
				case "layout":
					this.setState("layout");
					break;
				case "designer":
				default:
					this.setState("designer");
			}
		}
		
		[slot] public function editLayout( screenData:Object ):void
		{
			this.addState("layout", new LayoutPerspective( screenData ) );
			this.setState("layout");
		}
	}
}